package com.lt.flashcard.model.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.bson.types.ObjectId;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;

/**
 * Store the comment of a flashcardset
 * @author ocsen
 *
 */
@Entity("fcscomment")
public class FCSComment {
	
	@Id
	private ObjectId id;
	
	/**
	 * The flashcardset id
	 */
	private Long fcsid;
	
	/**
	 * The message of comment
	 */
	private String message = "";
	
	/**
	 * The username
	 */
	private String username;
	
	private Long uid;
	
	private Date created = new Date();
	
	/**
	 * The status of this comment
	 */
	private int status = STATUS_NORMAL;
	public static final int STATUS_NORMAL = 0;
	public static final int STATUS_SPAM = 1;
	
	/**
	 * List of replies comments
	 */
	private List<FCSComment> replies;

	public ObjectId getId() {
		return id;
	}

	public void setId(ObjectId id) {
		this.id = id;
	}

	public Long getFcsid() {
		return fcsid;
	}

	public void setFcsid(Long fcsid) {
		this.fcsid = fcsid;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Long getUid() {
		return uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public List<FCSComment> getReplies() {
		if(replies == null){
			replies = new ArrayList<FCSComment>();
		}
		return replies;
	}

	public void setReplies(List<FCSComment> replies) {
		this.replies = replies;
	}
}
